import { BASE_URL } from '../consts/api';
import { get, post } from './api';

// api 默认 _ 开头命名方法
export async function _getRank() {
  if (import.meta.env.DEV) return [{ username: '虚位以待', score: 1000 }];
  const resp = await get({
    url: BASE_URL + '/rank',
    params: {},
  });
  return resp;
}

export async function _postScore(username: string, score: number) {
  const scoreStr = String(score);
  const resp = await post({
    url: BASE_URL + '/rank',
    body: {
      username,
      scoreStr,
    },
  });
  return resp;
}
